home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Mar 20, 1997
- // Author: ramesh
- //
- // Description:
- // This script defines option box for the pointCurveConstraint menu item.
- //
- // Input Arguments:
- // int action
- // 0 - just execute the command.
- // 1 - show option box dialog.
- // 2 - return the drag command.
- //
- // Return Value:
- // None.
- //
- proc setOptionVars (int $forceFactorySettings)
- {
- pointCurveConstraintSetOptionVars( $forceFactorySettings );
- }
-
- proc createPointCurveConstraintUI( string $parent )
- {
- setParent $parent ;
-
- columnLayout pointCurveConstraintOptionsColumnLayout;
- //
- // cos for the first or both surfaces ?
- //
- checkBoxGrp -ncb 1
- -label ""
- -label1 "Keep Original"
- constraintKeepOriginalBoxGrp ;
- floatSliderGrp
- -field true -min 0.1 -max 10.0 -l "Point Weight"
- constraintWtSlider;
- setParent .. ;
- }
-
- proc string assembleCmd()
- {
- string $cmd ;
- setOptionVars(false) ;
-
- // query the settings for cmd(s).
- //
- int $doHistory = `constructionHistory -q -tgl`;
- int $keepOriginal = `optionVar -q pointCurveConstraintKeepOriginal` ;
- float $wt = `optionVar -q pointCurveConstraintWt` ;
- $cmd = "pointCurveConstraintPreset" ;
- $cmd = $cmd + "( " + $doHistory + " ," + $keepOriginal + " , " + $wt + ")";
- return $cmd ;
- }
-
- proc pointCurveConstraintOptions()
- {
- string $commandName = "pointCurveConstraint" ;
- string $optionBoxTitle = "Point On Curve Options" ;
- string $applyTitle = "Create";
-
-
- // build option box methods.
- //
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- string $layout = getOptionBox();
- setParent $layout;
-
- setOptionBoxCommandName($commandName);
- setUITemplate -pushTemplate DefaultTemplate;
- waitCursor -state 1;
- tabLayout -tabsVisible false -scr true;
- string $parent = `columnLayout -adjustableColumn 1`;
- createPointCurveConstraintUI($parent);
- waitCursor -state 0;
- setUITemplate -popTemplate;
-
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit -label $applyTitle
- -command ($callback + " " + $parent + " " + 1)
- $applyBtn;
-
- // 'Save' button.
- //
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
- $saveBtn;
-
- // 'Reset' button.
- //
- string $resetBtn = getOptionBoxResetBtn();
- button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn;
-
- // Set the option box title.
- //
- setOptionBoxTitle($optionBoxTitle);
-
- // Customize the 'Help' menu item text.
- //
- setOptionBoxHelpTag( "PointOnCurve" );
-
- eval (($setup + " " + $parent + " " + 0));
- showOptionBox();
- }
-
-
- global proc pointCurveConstraintSetup(
- string $parent,
- int $forceFactorySettings)
- {
- // retrieve option settings.
- //
- setOptionVars($forceFactorySettings);
- setParent $parent;
-
- // query all the option vars and set the controls.
- //
- int $keepOriginal = `optionVar -q pointCurveConstraintKeepOriginal` ;
- checkBoxGrp -edit -v1 $keepOriginal constraintKeepOriginalBoxGrp ;
-
- float $wt = `optionVar -q pointCurveConstraintWt` ;
- floatSliderGrp -edit -value $wt constraintWtSlider ;
- }
-
-
- global proc pointCurveConstraintCallback(
- string $parent,
- int $doIt )
- {
- setParent $parent ;
-
- // get Values from controls.
- //
- int $keepOriginal = `checkBoxGrp -q -v1 constraintKeepOriginalBoxGrp`;
- float $wt = `floatSliderGrp -q -value constraintWtSlider` ;
-
- optionVar -floatValue pointCurveConstraintWt $wt ;
- optionVar -intValue pointCurveConstraintKeepOriginal $keepOriginal ;
-
- if ($doIt) {
- performPointCurveConstraint(0) ;
- addToRecentCommandQueue "performPointCurveConstraint 0" "PointCurve Constraint";
- }
- }
-
- global proc string performPointCurveConstraint(
- int $action )
- //
- // Description :
- // 0 - do the command.
- // 1 - show the option box.
- // 2 - return the drag command.
- //
- {
-
- string $cmd = "" ;
- switch( $action ) {
- case 0 :
- // do the cmd.
- //
- setOptionVars(false) ;
- $cmd = `assembleCmd` ;
- eval($cmd) ;
- break ;
- case 1 :
- // option Box.
- //
- pointCurveConstraintOptions ;
- break ;
- case 2 :
- // return the drag string with the set options
- // on to shelf
- //
- $cmd = `assembleCmd` ;
- break ;
-
- }
- return $cmd ;
- }
-
-